Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#1327): Fixed package.json exports to work with moduleResolution "bundle" #1388

Closed
wants to merge 1 commit into from

Conversation

lupas
Copy link

@lupas lupas commented May 1, 2023

Fixes #1327 as proposed by RebeccaStevens here as well as #1384.

With Typescript 5 & vuejs/tsconfig 0.3.2, moduleResolution: 'bundle' has become standard.

However, this package does not properly define typings in package.json which results in type-checking to fail & the following warning:

TS7016: Could not find a declaration file for module 'vue-i18n'. '/.../node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js' implicitly has an 'any' type.
  There are types at '/.../node_modules/vue-i18n/dist/vue-i18n.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vue-i18n' library may need to update its package.json or typings.

I'm not completely sure if the node and browser exports still serve any value, might wanna include them again if you see a reason for them.

Copy link

@haoqunjiang haoqunjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this change is not necessary (and incorrect, because there's no .cts file in dist).

The current package.json already works with "moduleResolution": "bundler".
It's just not yet tagged as latest. You can try it with npm add vue-i18n@next or npm add vue-i18n@beta

@kazupon
Copy link
Member

kazupon commented May 9, 2023

@sodatea
Thanks for your follow up!

@lupas
This PR is not necessary as npm i vue-i18n@next already supports it.
I would sorry to have spent your time.

If you have avoided #1327 and #1384 related issues around typescript, I would recommend installing the next tag version, (i.e. vue-i18n v9.3).
Currently in beta, this version has not changed much in terms of functionality from v9.2. Actually, It's used in nuxt i18n v8 beta. (I'm working on nuxt i18n right now)

@kazupon kazupon closed this May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Includes backwards-compatible fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript Import issue with NodeNext
3 participants